package com.stdspringboot.service.impl;

import com.stdspringboot.entity.User;
import com.stdspringboot.mapper.IUserMapper;
import com.stdspringboot.service.IModifyPasswordService;
import com.stdspringboot.vo.JsonResult;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class ModifyPasswordSrvImpl implements IModifyPasswordService {

    @Resource
    private IUserMapper mapper;

    public JsonResult modify(String username, String newPassword) {

        User user=new User();
        user.setUsername(username);
        user.setPassword(newPassword);
        int i=mapper.modifyPassword(user);
        System.out.println("影响的行数："+i);
        JsonResult jr=new JsonResult(JsonResult.CODE_SUCCESS,"修改成功！");
        return jr;
    }
}
